<link href="__CDN__/assets/css/app_new.css" rel="stylesheet">
<style>
    .am-active.w100 {
        width: 100%;
    }

    .merchant-wrap {
        padding: 0 .3rem;
    }

    .CollectList {
        padding-left: 0;
        height: 75%;
        overflow: scroll;
        overflow-y: auto;
    }
    .merchant-panel {
        height: 85vh;
    }
    .merchant-info-title {
        color: #ff7300;
        border: 1px solid #ff7300;
        border-radius: 0.08rem;
        height: .72rem;
        line-height: .72rem;
        text-align: center;
        font-size: 0.3rem;
        width: 100%;
        margin-bottom: .2rem;
    }

    .level-info-wrap .id {
        font-size: 0.34rem;
        font-weight: 400;
        color: #000;
        margin-bottom: 0.2rem;
        line-height: 0.5rem;
    }

    .level-info-wrap .nickname {
        font-size: 0.26rem;
        color: #777;
        line-height: 0.5rem;
    }

    .level-info-wrap .time {
        font-size: 0.26rem;
        color: #777;
        line-height: 0.5rem;
    }

    .level1-group {
        position: fixed;
        width: 100%;
        height: 99%;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }
</style>
<div class="all-container">

    <div class="login-register-header">
        <div class="back-btn"><a href="javascript:history.go(-1)"><img src="/map/images/return@2x.png" alt="返回" /></a>
        </div>
        <div class="am-tabs" data-am-tabs="{noSwipe: 1}" id="doc-tab-demo-2">
            <ul class="am-tabs-nav am-nav am-nav-tabs invite-header-c d-flex">
                <li class="am-active invite-on"><a href="javascript: void(0)">海报推广</a></li>
                <li class="invite-on"><a href="javascript: void(0)">我的邀请</a></li>
            </ul>
            <div class="am-tabs-bd">
                <div  data-tab-panel-0 class="am-tab-panel am-fade am-in am-active">
                    <div id="invite-poster">
                        <div>
                            <p>扫码立即成为会员</p>
                            <div><img src="{$path}" alt="二维码"></div>
                            <span>{$user.code}</span>
                            <p>您的邀请码</p>
                        </div>
                        <div>
                            <button onclick="alert('长按二维码保存')"></button>
                            <button class="fuzhi" data-clipboard-action="copy"
                                data-clipboard-text="{$code_url}"></button>
                        </div>
                        <!-- <div style="margin-bottom: 0.5rem;">
                            <p>分享到</p>
                            <ul class="d-flex">
                                <li class="fuzhi" data-clipboard-action="copy" data-clipboard-text="{$code_url}">
                                    <img src="/map/images/WeChat.png" alt="链接">
                                    <p>微信</p>
                                </li>
                                <li class="fuzhi" data-clipboard-action="copy" data-clipboard-text="{$code_url}">
                                    <img src="/map/images/Moments.png" alt="链接">
                                    <p>朋友圈</p>
                                </li>
                                <li class="fuzhi" data-clipboard-action="copy" data-clipboard-text="{$code_url}">
                                    <img src="/map/images/qq.png" alt="链接">
                                    <p>QQ</p>
                                </li>
                                <li class="fuzhi" data-clipboard-action="copy" data-clipboard-text="{$code_url}">
                                    <img src="/map/images/weibo.png" alt="链接">
                                    <p>微博</p>
                                </li>
                            </ul>
                        </div> -->
                    </div>
                </div>
                <div  data-tab-panel-1 class="am-tab-panel am-fade">
                    <div class="merchant-panel">
                        <div class="merchant-wrap">
                            <div class="merchant-info-title" href="javascript: void(0)">一级会员(<span class="num"></span>)人</div>
                            <div class="level1-group">
                                <div class="CollectList"></div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
<!-- <script type="text/javascript" src="__CDN__/assets/js/zepto.min.js"></script> -->
<script type="text/javascript" src="__CDN__/assets/js/clipboard.min.js"></script>
<script type="text/javascript" src="__CDN__/assets/js/PullToRefresh.min.js"></script>
<script>
    var clipboard = new Clipboard('.fuzhi');
    clipboard.on('success', function (e) {
        alert('推广链接复制成功，赶快去分享吧~');
        e.clearSelection();
    });
    clipboard.on('error', function (e) {
        alert('复制失败');
    });
</script>
<style>
    .am-tabs-bd {
        overflow: scroll;
        -webkit-overflow-scrolling: touch;
    }

    .am-tabs-nav+.am-tabs-bd {
        padding-top: 0.88rem;
    }

    .fuzhi p {
        text-align: center;
        color: #555555;
        font-size: 0.22rem;
    }

    .am-tabs-nav {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        z-index: 1000;
    }

    .back-btn {
        z-index: 1001;
        position: fixed;
        top: 0;
        left: 0;
        height: 0.88rem;
    }

    #invite-poster {
        height: 85vh !important;
    }

    .invite-f-2 p {
        padding-top: 0.08rem;
    }
</style>


<script>
    var mycodePage = 1;
    var detail_id = 0;
    var flag = true;
    var refreshBox = new PullToRefresh({
        container: ".level1-group",
        // pull: {
        //     callback: function () {
        //         setTimeout(function () {
        //             myteam_users();
        //             refreshBox.endPullRefresh(true);
        //         }, 1000);
        //     }
        // },
        up: {
            callback: function () {
                setTimeout(function () {
                    myteam_users();
                    refreshBox.endUpLoading(flag);
                }, 1000);
            }
        }
    });
    console.log(refreshBox)

    function myteam_users() {
        $.post("{:url('user/selectsers')}", {
            live: 1,
            offset: mycodePage,
        }, function (res) {
            if(res.data.count == 0){
                $('.merchant-info-title .num').html('0')
            }
            if (res.code == 1) {              
                $('.merchant-info-title .num').html(res.data.count)
                mycodePage++
                $.each(res.data.data, function (index, value) {
                    detail_id = value.id
                    let template = `<a class="level-info-wrap" href="{:url('user/selectsers')}?parent_user_id=${detail_id}">
                    <p class="id">会员ID: ${value.id}</p>
                    <p class="nickname">会员昵称: ${value.username}</p>
                    <p class="time">会员申请时间: ${value.createtime}</p>
                </a>`
                    $(".CollectList").append(template);
                });
            } else {
                $(".loadingBox").html("没有更多数据了");
                flag = false;
                refreshBox.endPullRefresh(false);
            }
        })
    }
</script>